fix(ui): stop tailwind-merge from dropping text colors on custom font-size tokens - #64
Merged
Merged
Conversation
…-size tokens The design system's fontSize tokens (text-button, text-body, ...) are unknown to tailwind-merge's default config, so they fell into the text-color group and cancelled real color classes in the same cn() call — the primary Button lost text-brand-fg to text-button, rendering dark inherited ink on the indigo background. Extend twMerge with the custom font-size class group so size and color merge independently. Fixes #62 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fontSizetokens (text-button,text-body, …) are unknown to tailwind-merge's default config, so it classified them as text colors. InButton,text-button(size clause) came aftertext-brand-fg(variant clause) incn(), so the white text class was silently dropped — same failure applied to thesecondary/ghostvariants'text-ink/text-muted.extendTailwindMergeincn()declaring the custom font-size class group, so sizes and colors merge independently.Verification
twMerge('bg-brand text-brand-fg …', 'px-5 py-3 text-button')now keepstext-brand-fg; size-vs-size and color-vs-color conflicts still resolve correctly.rgb(255,255,255)on indigo in both light and dark themes.tsc --noEmitclean; 521/521 vitest tests pass.🤖 Generated with Claude Code